package com.yc.forum.Test;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RedisPostTest {
    public static void main(String[] args){
        JedisPool jp=new JedisPool();
        try (Jedis jedis = jp.getResource()) {
            for (int i = 1; i <= 100; i++) {
                Map<String,String> map=new HashMap<>();
                String post_id = "post_" + i;
                map.put("likesum",i*100+"");
                map.put("commentsum",i*100+i+"");
                map.put("collectsum",i*100+2*i+"");
                jedis.hmset(post_id,map);
                System.out.println(jedis.hmget(post_id,"likesum","commentsum","collectsum"));
            }
        }
    }

}
